<template>
	<view class="container">
		<view class="content_header">
			<view class="title">{{ info.title }}</view>
			<view class="desc">
				<text>{{ info.createtime_text }}</text>
				<text>阅读 {{ info.views }}</text>
			</view>
		</view>
		<view class="content_body">
			<u-parse :html="content" :tag-style="style" :show-with-animation="true"></u-parse>
		</view>
	</view>
</template>

<script>
	import { kepuDetail } from '../../api/api'
	export default {
		data() {
			return {
				content: '',
				style: {
					p: 'font-size:30rpx',
				},
				info: {}
			}
		},
		onLoad(options) {
			this.getNewsDetail(options.id)
		},
		methods: {
			getNewsDetail(id) {
				kepuDetail({ id }).then(res => {
					if(res.code == 1) {
						this.content = res.data.content
						this.info = res.data
					} else {
						this.$u.toast(res.msg)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page {
	background-color: #fff;
}
.container {
	width: 100%;
	padding: 25rpx;
	.content_header {
		width: 100%;
		.title {
			font-size: 38rpx;
			font-weight: 700;
		}
		.desc {
			color: #999;
			margin-top: 15rpx;
			text {
				margin-right: 50rpx;
			}
		}
	}
	.content_body {
		padding-top: 30rpx;
		line-height: 1.8;
		text-align: justify;
	}
}
</style>
